﻿<UserControl x:Class="Gao.Poker.App.View.Storage.StorageMain"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:UserControls="clr-namespace:Gao.Poker.App.UserControls" mc:Ignorable="d">
    <Grid Margin="0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="460"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="50"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Border  Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" BorderBrush="{x:Null}" BorderThickness="0,1" Margin="3">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#A1C7CFDA" Offset="0.991"/>
                    <GradientStop Color="#B5F1F1F1"/>
                    <GradientStop Color="#FFD2D2D2" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>
            <StackPanel Margin="0" Orientation="Horizontal" VerticalAlignment="Center">
                <Button Content="新增" VerticalContentAlignment="Center" FontSize="16" Command="{Binding AddCommand}" Style="{DynamicResource Blue}" Width="80"/>
                <Border BorderBrush="#CCFFFFFF" BorderThickness="1,0,0,0" HorizontalAlignment="Left"  Width="2.5" Background="#FFB6B6B6"/>
                <Button Content="修改" VerticalContentAlignment="Center" FontSize="16" Command="{Binding ModifyCommand}" Style="{DynamicResource Blue}" Width="80"/>
                <Border BorderBrush="#CCFFFFFF" BorderThickness="1,0,0,0" HorizontalAlignment="Left"  Width="2.5" Background="#FFB6B6B6"/>
                <Button Content="删除" VerticalContentAlignment="Center" FontSize="16" Command="{Binding DeleteCommand}" Style="{DynamicResource Blue}" Width="80"/>
                <Border BorderBrush="#CCFFFFFF" BorderThickness="1,0,0,0" HorizontalAlignment="Left"  Width="2.5" Background="#FFB6B6B6"/>
            </StackPanel>
        </Border>

        <Grid Grid.Column="0" Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="40"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="30"/>
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="0" Orientation="Horizontal" Margin="1" HorizontalAlignment="Center">
                <TextBlock Text="名称：" Margin="10,5,0,5" FontSize="14" VerticalAlignment="Center" />
                <TextBox Text="{Binding Path=ProductName}" Width="140" VerticalContentAlignment="Center" Margin="0,5,0,5" FontSize="14" />
                <TextBlock Text="编码：" Margin="15,5,0,5" FontSize="14" Width="60" TextAlignment="Right" VerticalAlignment="Center" />
                <TextBox Text="{Binding Path=BarCode}" Margin="0,5,0,5" Width="80" VerticalContentAlignment="Center" FontSize="14" />
                <Button Margin="10,1,1,1" Width="55" Style="{DynamicResource Orrange}" Content="查询" Command="{Binding SearchCommand}" Height="30" FontSize="14" />
            </StackPanel>
            <DataGrid Grid.Row="1" Margin="1,1,1.2,1" VerticalAlignment="Top" RowHeight="30" AutoGenerateColumns="False"
                      SelectionMode="Single"  CanUserAddRows="True" CanUserResizeColumns="False" CanUserResizeRows="False"
                      ItemsSource="{Binding Path=Products}" SelectedItem="{Binding Path=Product}" IsReadOnly="True" 
                      VerticalContentAlignment="Center" FontSize="16" VerticalScrollBarVisibility="Auto">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="编码" Width="120" Binding="{Binding Path=BarCode}"/>
                    <DataGridTextColumn Header="名称" Width="*" Binding="{Binding Path=ProductName}"/>
                    <DataGridTextColumn Header="单价" Width="80" Binding="{Binding Path=PPrice}"/>
                    <DataGridTextColumn Header="数量" Width="80" Binding="{Binding Path=PNumber}"/>
                </DataGrid.Columns>
            </DataGrid>
            <UserControls:Pager Grid.Row="2" Count="{Binding Path=ProductTotal}"/>
        </Grid>
        <ContentControl Grid.Column="1" Grid.Row="1" Name="cc"/>
    </Grid>
</UserControl>
